package api

import (
	"gitee.com/mkwchecking/sr-core/domain/service/srvctx"
	"github.com/gin-gonic/gin"
	"github.com/gin-gonic/gin/binding"
)

type (
	// NextResolve func(IApiCtx)
	Next func(apiCtx IApiCtx, srvCtx *srvctx.Context)
)

type IApiCtx interface {
	Context() *srvctx.Context
	WithGin(g *gin.Context) IApiCtx
	WithReq(req any, binds ...binding.Binding) IApiCtx
	WithNext(next Next) IApiCtx
	Do() bool
	WriteCustom(data any, code int)
	WritePageOK(data any, total int64, pageNum, pageSize int, msg string)
	WriteOK(data any, msg string)
	WriteErr(data any, err error, msg string)
}
